﻿using System;
using System.Activities;
using System.Collections.Generic;

namespace Vision.Core.ActivityComponents.Collections
{
    /// <summary>
    /// 
    /// </summary>
    /// <typeparam name="TKey"></typeparam>
    /// <typeparam name="TValue"></typeparam>
    public class ClearDictionary<TKey, TValue> : CodeActivity
    {
        [RequiredArgument]
        public InArgument<IDictionary<TKey, TValue>> Dictionary { get; set; }

        protected override void Execute(CodeActivityContext context)
        {
            IDictionary<TKey, TValue> dictionary = Dictionary.Get(context);
            if (dictionary != null)
            {
                dictionary.Clear();
            }
        }
    }
}
